home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Insets;
- import java.awt.Panel;
- import java.awt.image.ImageObserver;
-
- public abstract class BorderPanel2 extends Panel {
- int thickness;
- Image backgroundImage;
- Color backgroundColor;
- Image osImage;
- Graphics osg;
-
- public void SetThickness(int var1) {
- this.thickness = var1;
- }
-
- public void SetThickness(String var1) {
- if (var1 != null) {
- this.thickness = Integer.parseInt(var1);
- } else {
- this.thickness = 4;
- }
- }
-
- public void SetBackgroundColor(Color var1) {
- if (var1 != null) {
- ((Component)this).setBackground(var1);
- }
-
- this.backgroundColor = var1;
- }
-
- public void SetBackgroundImage(Image var1) {
- this.backgroundImage = var1;
- }
-
- public synchronized Dimension minimumSize() {
- return new Dimension(4 * this.thickness, 4 * this.thickness);
- }
-
- public Insets insets() {
- return new Insets(this.thickness, this.thickness, this.thickness, this.thickness);
- }
-
- public void paint(Graphics var1) {
- this.update(var1);
- }
-
- public void update(Graphics var1) {
- if (this.osImage == null) {
- this.osImage = ((Component)this).createImage(((Component)this).size().width, ((Component)this).size().height);
- this.osg = this.osImage.getGraphics();
- }
-
- Color var2 = this.osg.getColor();
- this.osg.setColor(((Component)this).getBackground());
- this.osg.fillRect(0, 0, ((Component)this).size().width, ((Component)this).size().height);
- this.osg.setColor(var2);
- if (this.backgroundImage != null) {
- int var3 = this.backgroundImage.getWidth(this);
- int var4 = this.backgroundImage.getHeight(this);
- int var5 = ((Component)this).size().width / var3;
- int var6 = ((Component)this).size().height / var4;
- ++var5;
- ++var6;
-
- for(int var7 = 0; var7 < var6; ++var7) {
- for(int var8 = 0; var8 < var5; ++var8) {
- this.osg.drawImage(this.backgroundImage, var8 * var3, var7 * var4, this);
- }
- }
- }
-
- this.DoPaint(this.osg);
- var1.drawImage(this.osImage, 0, 0, (ImageObserver)null);
- }
-
- public synchronized void reshape(int var1, int var2, int var3, int var4) {
- super.reshape(var1, var2, var3, var4);
- this.osImage = null;
- this.osg = null;
- this.DoResize(var3, var4);
- }
-
- public boolean imageUpdate(Image var1, int var2, int var3, int var4, int var5, int var6) {
- ((Component)this).repaint();
- return true;
- }
-
- abstract void DoPaint(Graphics var1);
-
- abstract void DoResize(int var1, int var2);
- }
-